package com.example.demo.mapper;

import com.example.demo.entity.Score_copy;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface Score_CopyMapper {
    @Select("select * from score_copy")
    List<Score_copy> findAllScore();

    @Select("select * from score_copy where id=#{id} and term=#{term}")
    List<Score_copy> findScoreByTermAndId(int id,String term);

    @Select("select * from score_copy where uploadid=#{uploadid}")
    List<Score_copy> findScoreByUploadId(int uploadid);

    @Delete("delete from score_copy where uploadid=#{uploadid}")
    int deleteScoreByUploadId(int uploadid);


    @Insert("<script> insert into score_copy "
            + "(flag,id,name,major,classi,course,teachername,gredit,escore,ascore,fscore,term,uploadid) "
            + "values "
            + "<foreach collection = 'list' item='record' separator=',' > "
            + " (#{record.flag},#{record.id},#{record.name},#{record.major},#{record.classi},#{record.course},#{record.teachername},#{record.gredit},#{record.escore},#{record.ascore},#{record.fscore},#{record.term},#{record.uploadid}) "
            + "</foreach>"
            + "</script>")
    int MultiAdd(List<Score_copy> list);
}
